#include <iostream>
#include "thetaM.h"
#include "collocationM.h"
using namespace std;
int main()
{
    double h = (double) 1/20, r, theta;
    cout << "After 1, 2, and 10 time steps, the Crank-Nicolson method with r = 1 gives results as follows." << endl;
    r = 1;
    theta = 0.5;
    theta_method ThetaM1(theta, r, h);
    print(ThetaM1.Solver(1));
    print(ThetaM1.Solver(2));
    print(ThetaM1.Solver(10));
    cout << "Crank-Nicolson with r = 2 gives results as follows." << endl;
    r = 2;
    theta_method ThetaM2(theta, r, h);
    print(ThetaM2.Solver(1));
    print(ThetaM2.Solver(2));
    print(ThetaM2.Solver(10));
    cout << "The BTCS with r = 1 gives results as follows." << endl;
    r = 1;
    theta = 1;
    theta_method ThetaM3(theta, r, h);
    print(ThetaM3.Solver(1));
    print(ThetaM3.Solver(2));
    print(ThetaM3.Solver(10));
    cout << "The collocation method in Example 11.258 with r = 1 gives results as follows." << endl;
    twostage_collocation_method ColM1(r, h);
    print(ColM1.Solver(1));
    print(ColM1.Solver(2));
    print(ColM1.Solver(10));
    cout << "===============================================================" << endl;
    cout << "BTCS and the collocation method in Example 11.258 with r = 1/2h" << endl;
    r = 1/(2*h);
    theta = 1;
    theta_method ThetaM4(theta, r, h);
    print(ThetaM4.Solver(1));
    print(ThetaM4.Solver(2));
    print(ThetaM4.Solver(10));
    twostage_collocation_method ColM2(r, h);
    print(ColM2.Solver(1));
    print(ColM2.Solver(2));
    print(ColM2.Solver(10));
    cout << "===============================================================" << endl;
    cout << "FTCS with r = 1/2, 1" << endl;
    r = 1/2.0;
    theta = 0;
    theta_method ThetaM5(theta, r, h);
    print(ThetaM5.Solver(1));
    print(ThetaM5.Solver(2));
    print(ThetaM5.Solver(10));
    r = 1;
    theta_method ThetaM6(theta, r, h);
    print(ThetaM6.Solver(1));
    print(ThetaM6.Solver(2));
    print(ThetaM6.Solver(10));
    cout << "===============================================================" << endl;
    cout << "the 1-stage Gauss-Legendre RK method in Example 11.227 with r = 1, 1/2h" << endl;
    r = 1;
    onestage_GaussLegendre_RK_method GLRKM1(r,h);
    print(GLRKM1.Solver(1));
    print(GLRKM1.Solver(2));
    print(GLRKM1.Solver(10));
    r = 1/(2*h);
    onestage_GaussLegendre_RK_method GLRKM2(r,h);
    print(GLRKM2.Solver(1));
    print(GLRKM2.Solver(2));
    print(GLRKM2.Solver(10));
    cout << "===============================================================" << endl;
}
